import type { IFormToken } from '@/types/bo/OrgBo.ts';

const FormToken: IFormToken = {
  org: {
    pageTitle: '组织机构',
    subTitle: '组织机构信息',
    basicTitle: '基本信息',
    codeTitle: '标识代码',
    geoTitle: '地理信息',
    regTitle: '注册信息',
    mgmtTitle: '管理关系',
    hrTitle: '人事股权关系',
    shareholderTitle: '股东信息',
    bizTitle: '业务组织',
    searchTitle: '搜索组织机构代码/名称/简称',
    basicInfo: {
      orgCode: {
        label: '组织机构代码',
        required: true,
        rules: [
          {
            pattern: /^\d{8}$/,
            message: '编码规则为 8 位数字流水码',
            trigger: 'blur',
          },
        ],
      },
      orgType: {
        label: '组织机构类型',
        renderer: 'select',
        required: true,
        tableName: 'cap_meta_org_type',
        params: {
          cached: true,
        },
      },
      isVirtualDept: {
        renderer: 'radio',
        label: '是否虚拟部门',
        options: [
          {
            value: '1',
            label: '是',
          },
          {
            value: '0',
            label: '否',
          },
        ],
      },
      orgFullName: {
        label: '组织机构名称',
        required: true,
        rules: [
          {
            // eslint-disable-next-line regexp/use-ignore-case, regexp/prefer-w
            pattern: /^[\u4E00-\u9FA5a-zA-Z0-9_]+$/,
            message: '仅支持汉字、字母、数字和下划线',
            trigger: 'blur',
          },
        ],
      },
      orgShortName: {
        label: '组织机构简称',
        required: true,
        rules: [
          {
            // eslint-disable-next-line regexp/use-ignore-case, regexp/prefer-w
            pattern: /^[\u4E00-\u9FA5a-zA-Z0-9_]+$/,
            message: '仅支持汉字、字母、数字和下划线',
            trigger: 'blur',
          },
        ],
      },
      enterpriseType: {
        label: '企业类型',
        renderer: 'select',
        tableName: 'cap_meta_ent_type',
      },
      regType: {
        label: '登记注册类型',
        renderer: 'select',
        tableName: 'cap_meta_reg_type',
      },
      isExtend: {
        renderer: 'radio',
        label: '是否扩展组织',
        required: true,
        disabled: true,
        options: [
          {
            value: 1,
            label: '是',
          },
          {
            value: 0,
            label: '否',
          },
        ],
      },
    },
    codeInfo: {
      uscc: {
        label: '统一社会信用代码',
        rules: [
          {
            pattern: /^[0-9A-HJ-NP-RT-Y]{2}\d{6}[0-9A-HJ-NP-RT-Y]{10}$/,
            message: '代码不合法',
            trigger: 'blur',
          },
        ],
      },
      icRegNo: {
        label: '工商注册登记号',
      },
      nOrgCode: {
        label: '全国组织机构代码',
      },
      vatNo: {
        label: '纳税人登记号',
      },
      otherIdNo: {
        label: '其他有效证件号',
      },
    },
    geoInfo: {
      country: {
        label: '国家',
        renderer: 'select',
        tableName: 'cap_meta_country',
        params: {
          cached: true,
        },
      },
      province: {
        label: '省份/直辖市',
        renderer: 'select',
        tableName: 'cap_meta_area',
        params: {
          cached: true,
          queryType: 2,
          parentId: 'country',
        },
      },
      city: {
        label: '城市',
        renderer: 'select',
        tableName: 'cap_meta_area',
        params: {
          cached: true,
          queryType: 2,
          parentId: 'province',
        },
      },
      town: {
        label: '区县',
        renderer: 'select',
        tableName: 'cap_meta_area',
        params: {
          cached: true,
          queryType: 2,
          parentId: 'city',
        },
      },
    },
    regInfo: {
      legalRep: {
        label: '法定代表人',
        required: true,
      },
      regAddress: {
        label: '注册地址',
      },
      postalCode: {
        label: '邮政编码',
      },
    },
    mgmtInfo: {
      upperMgrUnit: {
        label: '上级管理单位',
        renderer: 'select',
        required: true,
        tableName: 'cap_meta_upper_unit',
      },
      mgrPriox: {
        label: '管理组织排序码',
      },
      directEnterprise: {
        label: '所属直管企业',
        renderer: 'select',
        tableName: 'cap_meta_mgmt_ent',
      },
      equityType: {
        label: '股权属性',
        renderer: 'select',
        tableName: 'cap_meta_equity_type',
      },
      operationStatus: {
        label: '经营状态',
        renderer: 'select',
        tableName: 'cap_meta_op_status',
      },
    },
    hrInfo: {
      upperHrUnit: {
        label: '上级人事单位',
        required: true,
        renderer: 'select',
        tableName: 'cap_meta_upper_unit',
      },
      hrPriox: {
        label: '人事组织排序码',
      },
      upperEquityUnit: {
        label: '上级股权单位',
        renderer: 'select',
        required: true,
        tableName: 'cap_meta_upper_unit',
      },
      equityPriox: {
        label: '股权组织排序码',
      },
    },
    shareholderInfo: {
      stockholderName: {
        label: '股东名称',
      },
      stockholderCategory: {
        label: '内外股东标识',
        renderer: 'select',
        tableName: 'cap_meta_shr_sign',
      },
      stockholderType: {
        label: '股东经济类型',
        renderer: 'select',
        tableName: 'cap_meta_shr_type',
      },
      shareholdingRatio: {
        label: '股东持股比例',
        rules: [
          {
            pattern: /^\d+(\.\d+)?%$/,
            message: '请输入正确的百分比格式（如 10%）',
            trigger: 'blur',
          },
        ],
      },
    },
  },
  biz: {
    orgCode: {
      label: '组织机构代码',
      width: '175',
      minWidth: '175',
    },
    name: {
      label: '组织机构名称',
      width: '175',
      minWidth: '175',
    },
    typeName: {
      label: '业务组织类型',
      width: '175',
      minWidth: '175',
    },
  },
  mgmt: {
    baseInfo: {
      id: { label: '序号' },
      code: { label: '编码', required: true, filter: 1, popover: 1 },
      name: {
        label: '名称',
        required: true,
        filter: 2,
        popover: 2,
        rules: [
          {
            // eslint-disable-next-line regexp/use-ignore-case, regexp/prefer-w
            pattern: /^[\u4E00-\u9FA5a-zA-Z0-9_]+$/,
            message: '仅支持汉字、字母、数字和下划线',
            trigger: 'blur',
          },
        ],
      },
      unitId: { label: '所属组织机构', required: true, popover: 3 },
      status: {
        label: '状态',
        renderer: 'select',
        filter: 3,
        options: [
          { value: '0', label: '停用' },
          { value: '1', label: '启用' },
        ],
      },
      createTime: { label: '创建时间', filter: 4, time: true },
      createBy: { label: '创建人', filter: 5 },
      updateBy: { label: '更新人' },
      updateTime: { label: '更新时间' },
      remark: { label: '备注', popover: 3 },
    },
    pageTitle: '管理组织',
    dialogTitle: '新增管理组织',
  },
  bizType: {
    baseInfo: {
      id: { label: '序号' },
      code: { label: '编码', required: true, filter: 1, popover: 1 },
      name: {
        label: '名称',
        required: true,
        filter: 2,
        popover: 2,
        rules: [
          {
            // eslint-disable-next-line regexp/use-ignore-case, regexp/prefer-w
            pattern: /^[\u4E00-\u9FA5a-zA-Z0-9_]+$/,
            message: '仅支持汉字、字母、数字和下划线',
            trigger: 'blur',
          },
        ],
      },
      createBy: { label: '创建人' },
      createTime: { label: '创建时间', filter: 3, time: true },
      updateBy: { label: '更新人', filter: 4 },
      updateTime: { label: '更新时间' },
      remark: { label: '备注', popover: 3 },
    },
    tableCode: '业务组织编码',
    tableName: '业务组织名称',
    pageTitle: '业务组织类型',
    dialogTitle: '新增业务组织类型',
  },
  action: {
    actions: '操作',
    sure: '确定',
    create: '新增',
    reset: '重置',
    query: '查询',
    fold: '收起',
    edit: '编辑',
    stop: '停用',
    start: '启用',
    cancel: '取消',
    save: '保存',
    details: '详情',
    createNext: '新增下级',
    createParallel: '新增平级',
  },
  message: {
    index: '序号',
    apiError: '接口错误',
    validFail: '存在不合法的数据，请仔细检查后再保存',
    empty: '暂无数据',
    retry: '点击重试',
    startDate: '开始日期',
    endDate: '结束日期',
    giveUp: '确定要放弃保存吗？',
    saveTip: '确定要保存吗？',
    saved: '保存成功',
    created: '创建成功',
    saveFail: '保存失败',
    createFail: '创建失败',
    input: '请输入',
    cancel: '取消',
    tip: '提示',
    select: '请选择',
    unstable: '新增节点',
    tag: '扩展',
    giveUpEdit: '当前新增的组织结构数据未保存，请确认切换到新组织机构吗？',
  },
};

export { FormToken };
